package com.zxtech.zzm.zxmonitorsocket.util

import android.text.TextUtils
import com.zxtech.zzm.core.util.LoggerUtil
import com.zxtech.zzm.zxmonitorsocket.Config

class SocketLoggerUtil : LoggerUtil() {
  companion object {
    private const val TAG = "zxmonitor_socket"
    fun logSocket(msg: String) {
      logSocket(msg, LOGGERUTIL_DEBUG)
    }

    fun logSocket(
      msg: String,
      level: Int
    ) {
      if (TextUtils.isEmpty(msg) || !Config.SOCKET_DEBUG) {
        return
      }
      when (level) {
        LOGGERUTIL_VERBOSE -> log(TAG, msg, LOGGERUTIL_VERBOSE)
        LOGGERUTIL_DEBUG -> log(TAG, msg, LOGGERUTIL_DEBUG)
        LOGGERUTIL_INFO -> log(TAG, msg, LOGGERUTIL_INFO)
        LOGGERUTIL_WARNING -> log(TAG, msg, LOGGERUTIL_WARNING)
        LOGGERUTIL_ERROR -> log(TAG, msg, LOGGERUTIL_ERROR)
        LOGGERUTIL_ASSERT -> log(TAG, msg, LOGGERUTIL_ASSERT)
        LOGGERUTIL_JSON -> log(TAG, msg, LOGGERUTIL_JSON)
        else -> log(TAG, msg, LOGGERUTIL_DEBUG)
      }
    }
  }
}